package com.xfcy.blog.dto;

import com.xfcy.blog.valid.AddGroup;
import com.xfcy.blog.valid.SimpleValue;
import com.xfcy.blog.valid.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 注册邮箱 接收前端的 DTO类
 * @author 晓风残月Lx
 * @date 2023/4/19 17:40
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EmailRegisterDTO {

    /**
     *  邮箱号
     */
    @NotBlank(message = "邮箱不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Email(message = "邮箱必须是一个合法的邮箱地址" ,groups = {AddGroup.class, UpdateGroup.class})
    private String email;

    /**
     * 密码
     */
    @Length(min = 6, message = "密码不能小于6位", groups = {AddGroup.class, UpdateGroup.class})
    @NotBlank(message = "密码不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String password;

    /**
     * 昵称
     */
    @Min(value = 2, message = "昵称不能小于2位", groups = {AddGroup.class})
    @NotBlank(message = "昵称不能为空", groups = {AddGroup.class})
    private String nickname;


    /**
     * 验证码
     */
    @SimpleValue(value = 6, message = "验证码不为6位", groups = {AddGroup.class, UpdateGroup.class})
    @NotBlank(message = "验证码不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String code;

}
